package com.example.apione.model;

import com.example.apione.dao.LoginDao;
import com.example.apione.entity.Login;
import com.example.apione.utils.EncryptUtil;

import java.util.HashMap;

/**
 * @author 尘落
 * @date 2023/2/24
 */
public class LoginApimodel {
    public static HashMap<String, String> login(LoginDao loginDao){
        Login adminData=loginDao.selectById(1);
        String username =adminData.getUsername();
        String password =adminData.getPassword();
        HashMap<String,String> hashMap =new HashMap<>();
        hashMap.put("username",username);
        hashMap.put("password",password);
        return hashMap;
    }
    public static String passwd(LoginDao loginDao,String passwddata){
        String passwd = EncryptUtil.md5Code(passwddata);
        Login login=new Login();
        login.setId(1);
        login.setPassword(passwd);
        loginDao.updateById(login);
        return "ok";
    }


}
